<?php

class Application_Form_Linestop extends Zend_Form
{

    public function init()
    {
        $this->setMethod('post');
	
		$category1 = new Zend_Form_Element_Select('lines');
		$category1->setLabel('BusLines')
					->setRequired(true)
					->addFilter('Int')
					->addValidator('NotEmpty', true, array('integer','zero'));
		$category1->addMultiOption(0,"Select line...");
		
		$category2 = new Zend_Form_Element_Select('stops');
		$category2->setLabel('BusStops')
					->setRequired(true)
					->addFilter('Int')
					->addValidator('NotEmpty', true, array('integer','zero'));
		$category2->addMultiOption(0,"Select stop...");
	
        $table1 = new Application_Model_DbTable_Lines();
		$table2 = new Application_Model_DbTable_Stops();
		
		
		
		foreach($table1->fetchAll() as $a)
		{
			$category1->addMultiOption($a->id, $a->name);
		}
		
		foreach ($table2->fetchAll() as $a)
		{
			$category2->addMultiOption($a->id, $a->name);
		}
		
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setAttrib('id', 'submitbutton');
		
		$this->addElements(array($category1, $category2, $submit));
    }


}

